*********************************************************
**ANALYZING AID-DATA AND AFROBAROMETER FOURTH ROUND DATA*
**Last Edit: July 7, 2021, by KB*************************
*********************************************************

* Note: The graphics in this file make use of the scheme_tufte.ado graphics scheme.
 * ssc install scheme_tufte

use "data/AfroR4_distancescapitalAidprojects.dta", clear


**JUSTIFYING USE OF INTEREST IN PUBLIC AFFAIRS MEASURE*
************
*APPENDIX L*
************

corr interest4point radio television newspapers knowMP if urbrur=="Urban"
corr interest4point radio television newspapers knowMP if urbrur=="Rural" 


**********************
*TABLE M1*
**********************


reg NGOHELP less5km closecapital veryinterested interestXclose closeX5 interestXless5 interestXcloseX5 education rural youth old i.COUNTRY, cluster(uniqueea)
*what is the effect on far, not interested
lincom _b[less5km]
*what is the effect on far, interested
lincom _b[less5km]+ _b[interestXless5]
*what is the effect on close, not interested
lincom _b[less5km] + _b[closeX5]
*what is the effect on close, interested
lincom _b[less5km] + _b[closeX5] + _b[interestXless5] + _b[interestXcloseX5]


reg NGOHELP less10km closecapital veryinterested interestXclose closeX10 interestXless10 interestXcloseX10 education rural youth old i.COUNTRY, cluster(uniqueea)
*what is the effect on far, not interested
lincom _b[less10km]
*what is the effect on far, interested
lincom _b[less10km]+ _b[interestXless10]
*what is the effect on close, not interested
lincom _b[less10km] + _b[closeX10]
*what is the effect on close, interested
lincom _b[less10km] + _b[closeX10] + _b[interestXless10] + _b[interestXcloseX10]


reg NGOHELP less5km closecapital veryinterested interestXclose closeX5 interestXless5 interestXcloseX5 education rural youth old i.Q79 if Q79<900, cluster(uniqueea)
*what is the effect on far, not interested
lincom _b[less5km]
*what is the effect on far, interested
lincom _b[less5km]+ _b[interestXless5]
*what is the effect on close, not interested
lincom _b[less5km] + _b[closeX5]
*what is the effect on close, interested
lincom _b[less5km] + _b[closeX5] + _b[interestXless5] + _b[interestXcloseX5]


reg NGOHELP less10km closecapital veryinterested interestXclose closeX10 interestXless10 interestXcloseX10 education rural youth old i.Q79 if Q79<900, cluster(uniqueea)
*what is the effect on far, not interested
lincom _b[less10km]
*what is the effect on far, interested
lincom _b[less10km]+ _b[interestXless10]
*what is the effect on close, not interested
lincom _b[less10km] + _b[closeX10]
*what is the effect on close, interested
lincom _b[less10km] + _b[closeX10] + _b[interestXless10] + _b[interestXcloseX10]

**********************
*ALTERNATIVE MEASURES*
**********************

*how often do you get news from the radio: never*
gen informed = 0 if radio==0
*at least a bit*
replace informed = 1 if radio==1 | radio==2 | radio==3 | radio==4


gen informedXclose = informed*closecapital
gen informedXless5 = informed*less5km
gen informedXless10 = informed*less10km
gen informedXcloseX5 = informed*closeX5
gen informedXcloseX10 = informed*closeX10

*********************
*TABLE N1, Column 1 & 2*
*********************

reg NGOHELP less5km closecapital informed informedXclose closeX5 informedXless5 informedXcloseX5 education rural youth old i.COUNTRY, cluster(uniqueea)
*what is the effect on far, not interested
lincom _b[less5km]
*what is the effect on far, interested
lincom _b[less5km]+ _b[informedXless5]
*what is the effect on close, not interested
lincom _b[less5km] + _b[closeX5]
*what is the effect on close, interested
lincom _b[less5km] + _b[closeX5] + _b[informedXless5] + _b[informedXcloseX5]

reg NGOHELP less10km closecapital informed informedXclose closeX10 informedXless10 informedXcloseX10 education rural youth old i.COUNTRY, cluster(uniqueea)
*what is the effect on far, not interested
lincom _b[less10km]
*what is the effect on far, interested
lincom _b[less10km]+ _b[informedXless10]
*what is the effect on close, not interested
lincom _b[less10km] + _b[closeX10]
*what is the effect on close, interested
lincom _b[less10km] + _b[closeX10] + _b[informedXless10] + _b[informedXcloseX10]

***************************
do "dofiles/Conflict_Exposure_Coding.do"

*Coding exposure to conflict: Exposure to conflict in the past 5 years*
egen conflictexposure5 = rowmax(conflictNigeria2004a conflictNigeria2004b conflictUganda2004 conflictUganda2005 conflictUganda2006 conflictUganda2007)

gen noconflict = 1-conflictexposure5

gen noconflictX5 = noconflict*less5km
gen noconflictX10 = noconflict*less10km
gen interestXnoconflict=veryinterested*noconflict

gen interestXnoconflictX5 = veryinterested*noconflictX5
gen interestXnoconflictX10 = veryinterested*noconflictX10

*********************
*TABLE N1, Column 3 & 4*
*********************

reg NGOHELP less5km noconflict veryinterested interestXnoconflict noconflictX5 interestXless5 interestXnoconflictX5 education rural youth old i.COUNTRY, cluster(uniqueea)
*what is the effect on conflict, not interested
lincom _b[less5km]
*what is the effect on conflict, interested
lincom _b[less5km]+ _b[interestXless5]
*what is the effect on no conflict, not interested
lincom _b[less5km] + _b[noconflictX5]
*what is the effect on no conflict, interested
lincom _b[less5km] + _b[noconflictX5] + _b[interestXless5] + _b[interestXnoconflictX5]


reg NGOHELP less10km noconflict veryinterested interestXnoconflict noconflictX10 interestXless10 interestXnoconflictX10 education rural youth old i.COUNTRY, cluster(uniqueea)
*what is the effect on conflict, not interested
lincom _b[less10km]
*what is the effect on conflict, interested
lincom _b[less10km]+ _b[interestXless10]
*what is the effect on no conflict, not interested
lincom _b[less10km] + _b[noconflictX10]
*what is the effect on no conflict, interested
lincom _b[less10km] + _b[noconflictX10] + _b[interestXless10] + _b[interestXnoconflictX10]


**FIGURE: GRAPHING MARGINAL EFFECTS OF AID BY CONDITION**
**For the purposes of graphing the effects of aid by combinations of citizen interest and state capacity
**simplest to translate the interactions between info and capacity into a 4-point categorical variable

*Alternative measure of state capacity*

gen condition2 = 0 if noconflict==0 & veryinterested==0
replace condition2 = 1 if noconflict==0 & veryinterested==1
replace condition2 = 2 if noconflict==1 & veryinterested==0
replace condition2 = 3 if noconflict==1 & veryinterested==1

label define conditioncat 0 "Low State Capacity, Uninformed Citizen" 1 "Low State Capacity, Informed Citizen" 2 "High State Capacity, Uninformed Citizen" 3 "High State Capacity, Informed Citizen"
label values condition conditioncat
label define conditioncat2 0 "Post-Conflict, Uninformed Citizen" 1 "Post-Conflict, Informed Citizen" 2 "No Conflict, Uninformed Citizen" 3 "No Conflict, Informed Citizen"
label values condition2 conditioncat2

label var less5km "Aid Project (5)"
label var less10km "Aid Project (10)"
label define aidcat 0 "No Aid" 1 "ME for"
label values less5km aidcat
label values less10km aidcat

set scheme tufte

***********************
*FIGURE N1, bottom row*
***********************

areg NGOHELP less5km#i.condition2 i.condition2 education rural youth old, absorb(COUNTRY) cluster(uniqueea)
estimates store A
coefplot A, xline(0) omitted baselevels drop(_cons education rural youth old 0.less5km#0.condition2 0.less5km#1.condition2 0.less5km#2.condition2 0.less5km#3.condition2 0.condition2 1.condition2 2.condition2 3.condition2)/*
*/ coeflabels(, interaction("" "")) xscale(range(-0.2 (0.2) 0.4)) title(Aid Project within 5km)
graph export "figures_tables/FigN1_aid5kmCOUNTRY_bytreatment2.tif", replace

areg NGOHELP less10km#i.condition2 i.condition2 education rural youth old, absorb(COUNTRY) cluster(uniqueea)
estimates store B
coefplot B, xline(0) omitted baselevels drop(_cons education rural youth old 0.less10km#0.condition2 0.less10km#1.condition2 0.less10km#2.condition2 0.less10km#3.condition2 0.condition2 1.condition2 2.condition2 3.condition2)/*
*/ coeflabels(, interaction("" "")) xscale(range(-0.2 (0.2) 0.4)) title(Aid Project within 10km)
graph export "figures_tables/FigN1_aid10kmCOUNTRY_bytreatment2.tif", replace


*Alternative measure of information*

gen condition4 = 0 if closecapital==0 & informed==0
replace condition4 = 1 if closecapital==0 & informed==1
replace condition4 = 2 if closecapital==1 & informed==0
replace condition4 = 3 if closecapital==1 & informed==1

label define conditioncat4 0 "Low State Capacity, Uninformed Citizen" 1 "Low State Capacity, Informed Citizen" 2 "High State Capacity, Uninformed Citizen" 3 "High State Capacity, Informed Citizen"
label values condition4 conditioncat4

********************
*FIGURE N1, top row*
********************

set scheme tufte
areg NGOHELP less5km#i.condition4 i.condition4 education rural youth old, absorb(COUNTRY) cluster(uniqueea)
estimates store A
coefplot A, xline(0) omitted baselevels drop(_cons education rural youth old 0.less5km#0.condition4 0.less5km#1.condition4 0.less5km#2.condition4 0.less5km#3.condition4 0.condition4 1.condition4 2.condition4 3.condition4)/*
*/ coeflabels(, interaction("" "")) xscale(range(-0.2 (0.2) 0.4)) title(Aid Project within 5km)
graph export "figures_tables/FigN1_aid5kmCOUNTRY_bytreatment_i2.tif", replace

areg NGOHELP less10km#i.condition4 i.condition4 education rural youth old, absorb(COUNTRY) cluster(uniqueea)
estimates store B
coefplot B, xline(0) omitted baselevels drop(_cons education rural youth old 0.less10km#0.condition4 0.less10km#1.condition4 0.less10km#2.condition4 0.less10km#3.condition4 0.condition4 1.condition4 2.condition4 3.condition4)/*
*/ coeflabels(, interaction("" "")) xscale(range(-0.2 (0.2) 0.4)) title(Aid Project within 10km)
graph export "figures_tables/FigN1_aid10kmCOUNTRY_bytreatment_i2.tif", replace


